//
//  TaskTest3View.swift
//  MakeMoney
//
//  Created by Fan ZhiQiang on 2025/8/26.
//

import SwiftUI

struct TaskTest3View: View {
    var struc: MyStruct
    
    var body: some View {
        Button("Click") {
            //struc = struc.updateName(newName: "SecondName")
        }
        Button("Print") {
            print(struc)
            
        }
    }
}

struct GoodStruct: View {
    var body: some View {
        TaskTest3View(struc: MyStruct(name: "FirstName", age: 20, pswd: "secture", isActive: true))
    }
}

struct MyStruct {
    let name: String
    let age: Int
    let pswd: String
    let isActive: Bool
    
    func updateName(newName: String) -> MyStruct {
        MyStruct(name: newName, age: age, pswd: pswd, isActive: isActive)
    }
    
}

#Preview {
    GoodStruct()
}
